package com.xinxin.intelligenceexam.api;

import com.xinxin.intelligenceexam.domain.HttpResult;
import com.xinxin.intelligenceexam.domain.Question;
import com.xinxin.intelligenceexam.domain.Student;

import java.util.List;

import retrofit2.http.Field;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.POST;
import retrofit2.http.Query;
import rx.Observable;

/**
 * User: Tianxin
 * Date: 2016-11-06
 * Time: 23:13
 */

public interface JavaExamApi {
/*    @FormUrlEncoded
    @POST("/x3/weather")
    Call<ResponseBody> get(
            @Field("cityid") String cityid,
            @Field("key") String key);
    @FormUrlEncoded
    @POST("/x3/weather")
    Call<ResponseBody> body(
            @Body String cityid);

    @GET("x3/weather")
    Observable<HeWeatherBean> getWeatherService(@Query("city") String city, @Query("key") String key);

    @GET("x3/attractions")
    Observable<HeWeatherBean> getScenicService(@Query("cityid") String cityid, @Query("key") String key);

    @GET("group/{id}/users")
    Call<List<User>> groupList(@Path("id") int groupId);

    @FormUrlEncoded
    @POST("user/edit")
    Call<User> updateUser(@Field("first_name") String first, @Field("last_name") String last);


    @Multipart//常用于文件上传
    @PUT("user/photo")
    Call<User> updateUser(@Part("photo") RequestBody photo, @Part("description") RequestBody description);

    @GET("user")
    Call<User> getUser(@Header("Authorization") String authorization);

    @Headers("Authorization: authorization")//这里authorization就是上面方法里传进来变量的值
    @GET("widget/list")
    Call<User> getUser();

    @Headers({
            "Accept: application/vnd.github.v3.full+json",
            "User-Agent: Retrofit-Sample-App"
    })
    @GET("widget/list")
    Call<List<Widget>> widgetList();*/

    @FormUrlEncoded
    @POST("le/json/login")
    Observable<HttpResult<Student>> studentLogin(@Field("student_code") String studentCode, @Field("password") String password);
    @FormUrlEncoded
    @POST("le/json/register")
    Observable<HttpResult> studentRegister(@Field("student_json") String studentJson);


    @GET("le/json/exam_questions")
    Observable<HttpResult<List<Question>>> getExamQuestions(@Query("question_count") int num);

//    @Headers({"Content-type:application/json;charset=UTF-8"})
//    @POST("specificlawyer/le/json/register")
//    Observable<HttpResult<Student>> studentRegister(@Body RequestBody studentBody);

}
